package com.tarena.rabbitmq.demo.consumer;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RabbitDemoConsumer {
    //准备一个消费方法 参数是rabbitmq整合springboot框架给传递的
    //可以传递消息体 消息对象 channel底层连接
    @RabbitListener(queues="dead-letter-queue")
    public void consume(String msg, Message message, Channel channel){
        log.info("消息对象:{},通道对象:{}",message,channel);
        log.info("消费者类获取消息:{}",msg);
    }
}
